Per-magazine attachment coordinates + two reload-end glitch fixes - #9
Open
Gamaun007 wants to merge 3 commits into
Open
Per-magazine attachment coordinates + two reload-end glitch fixes#9Gamaun007 wants to merge 3 commits into
Gamaun007 wants to merge 3 commits into
Conversation
Each offset field (positions/rotations/scale/parent_bone) can now be overridden per magazine section via keys suffixed with the mag section: s_magazine_<field>_<bone>_<mag_section> = ... Unsuffixed shared keys keep working exactly as before and remain the fallback, so existing weapon configs are unaffected. The suffixed key is resolved against the loaded mag; during the mid-reload swap the loaded mag is still nil/old, so it falls back to the incoming/ pending section the core already captures (incoming_mag_section / pending_swap_mag_section) - the model lands on its final coords immediately instead of jumping when the data commits. The swap path (change_specific_mag_model) applies the per-mag scale for the same reason. Documented in 2_guide_on_adding_to_new_anim_sets.ltx. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1. Skip set_model when the model path is unchanged (both the full refresh in update_scripted_magazines and the mid-reload swap in change_specific_mag_model): re-setting a live attachment's model resets its transform until the position/rotation setters re-apply, rendering one frame at the default pose. 2. Don't scale the attachment to 0 while a Mags Reloaded reload is still in progress: at reload end the idle anim triggers the no-mag refresh BEFORE the new mag data is committed (same frame), which hid the freshly inserted mag until the next animation change (movement). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
change_specific_mag_model swapped the model (and scale) mid-reload but left position/rotation at the previous mag's pose until the next idle refresh, so a mag could sit visibly wrong during the reload. Apply the per-mag position/rotation there too (same suffixed-key resolution), so the swapped model lands on its final pose immediately - matching the full refresh in update_scripted_magazines. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small, backward-compatible improvements to
scripted_magazines.script, ported onto the currentdev(0.2) refactor.1. Per-magazine attachment coordinates
Right now every mag on a gun shares one offset (
s_magazine_positions_<bone>, etc). If two mags for the same gun have different pivots/sizes, one of them sits wrong.This adds an optional per-mag override: any offset field can be suffixed with the magazine's section —
Resolution per field: if the suffixed key exists it's used, otherwise it falls back to the shared
s_magazine_<field>_<bone>key. Guns that only define the shared keys are completely unaffected — same behaviour as before.The suffixed key is resolved against the loaded mag. During the mid-reload swap the loaded mag is still nil/old, so it falls back to the section the core already captures (
incoming_mag_section/pending_swap_mag_section), so the model lands on its final coords immediately instead of jumping when the data commits. The swap path (change_specific_mag_model) applies the per-mag scale for the same reason. Documented with an AK example in2_guide_on_adding_to_new_anim_sets.ltx.2. Two reload-end visual glitch fixes
set_modelwhen the path is unchanged (bothupdate_scripted_magazinesandchange_specific_mag_model): re-setting a live attachment's model resets its transform until the position/rotation setters re-apply next tick, rendering one frame at the default pose.magazines.action_in_progress().Both are guard-only changes; the normal paths are untouched.